package com.li.core.service.system.impl;

import com.li.core.domain.system.InterfaceRequestLog;
import com.li.core.mapper.system.InterfaceRequestLogMapper;
import com.li.core.service.system.SyslogService;
import com.li.toolkit.constant.LogConst;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Description：
 * @Author：LiDong
 * @Create：2021/2/23
 * @Version：1.0.0
 */
@Service
public class SyslogServiceImpl implements SyslogService {

    private static final Logger logger = LoggerFactory.getLogger(SyslogServiceImpl.class);

    @Autowired
    private InterfaceRequestLogMapper logMapper;


    /**
     * 批量新增接口请求日志
     *
     * @param list
     */
    @Override
    public void insertInterfaceRequestLogBatch(List<InterfaceRequestLog> list) {
        try {
            for (InterfaceRequestLog interfaceRequestLog : list) {
                logMapper.insertSelective(interfaceRequestLog);
            }
        } catch (Exception e) {
            logger.error(LogConst.ERROR, e);
        }

    }

}
